//
//  LGConsultRecordMonitorCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/10/18.
//  咨询记录 - 体征监测

#import "LGConsultRecordMonitorCell.h"
#define lineHeight   viewPix(30)
@interface LGConsultRecordMonitorCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**  高压 */
@property (nonatomic , strong)UILabel *highPressure;
@property (nonatomic , strong)UILabel *highPressureUnit;
/**  低压 */
@property (nonatomic , strong)UILabel *lowPressure;
@property (nonatomic , strong)UILabel *lowPressureUnit;
/**  心率 */
@property (nonatomic , strong)UILabel *heartRate;
@property (nonatomic , strong)UILabel *heartRateUnit;
/**  身高 */
@property (nonatomic , strong)UILabel *heightTitle;
@property (nonatomic , strong)UILabel *heightUnit;
/**  体重 */
@property (nonatomic , strong)UILabel *weightTitle;
@property (nonatomic , strong)UILabel *weightUnit;
/**  腹围 */
@property (nonatomic , strong)UILabel *abdominalTitle;
@property (nonatomic , strong)UILabel *abdominalUnit;
/**  心功能等级 */
@property (nonatomic , strong)UILabel *heartGrade;
@property (nonatomic , strong)UIImageView *heartGradeTip;

@end

@implementation LGConsultRecordMonitorCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

#pragma mark
#pragma mark ====> 创建控件
#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.baseView];
    [self.baseView addSubview:self.highPressure];
    [self.baseView addSubview:self.highPressureTF];
    [self.baseView addSubview:self.highPressureUnit];
    [self.baseView addSubview:self.lowPressure];
    [self.baseView addSubview:self.lowPressureTF];
    [self.baseView addSubview:self.lowPressureUnit];
    [self.baseView addSubview:self.heartRate];
    [self.baseView addSubview:self.heartRateTF];
    [self.baseView addSubview:self.heartRateUnit];
    [self.baseView addSubview:self.heightTitle];
    [self.baseView addSubview:self.heightTF];
    [self.baseView addSubview:self.heightUnit];
    [self.baseView addSubview:self.weightTitle];
    [self.baseView addSubview:self.weightTF];
    [self.baseView addSubview:self.weightUnit];
    [self.baseView addSubview:self.abdominalTitle];
    [self.baseView addSubview:self.abdominalTF];
    [self.baseView addSubview:self.abdominalUnit];
    [self.baseView addSubview:self.heartGrade];
    [self.baseView addSubview:self.heartGradeTF];
    [self.baseView addSubview:self.heartGradeTip];
    [self.baseView addSubview:self.heartGradeBtn];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(viewPix(16));
        make.right.equalTo(self.contentView).offset(-viewPix(16));
        make.height.equalTo(@(lineHeight*7+viewPix(6)));
    }];
    [self.highPressureTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.highPressureUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.highPressure);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.highPressureUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.highPressure);
    }];
    
    [self.lowPressureTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.lowPressureUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.lowPressure);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.lowPressureUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.lowPressure);
    }];
    
    [self.heartRateTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.heartRateUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.heartRate);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.heartRateUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.heartRate);
    }];
    
    [self.heightTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.heightUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.heightTitle);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.heightUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.heightTitle);
    }];
    
    [self.weightTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.weightUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.weightTitle);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.weightUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.weightTitle);
    }];
    
    [self.abdominalTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.abdominalUnit.mas_left).offset(-4);
        make.centerY.equalTo(self.abdominalTitle);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.abdominalUnit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.abdominalTitle);
    }];
    
    [self.heartGradeTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.heartGradeTip.mas_left).offset(1);
        make.centerY.equalTo(self.heartGrade);
        make.width.equalTo(@(viewPix(150)));
        make.height.equalTo(@(lineHeight));
    }];
    [self.heartGradeTip mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(20));
        make.centerY.equalTo(self.heartGrade);
        make.width.height.equalTo(@(viewPix(12)));
    }];
    [self.heartGradeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.right.equalTo(self.heartGradeTF);
    }];
    
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.15 radius:0];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UILabel *)highPressure{
    if(!_highPressure){
        _highPressure = [UILabel lableWithText:@"高压" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _highPressure.frame = CGRectMake(viewPix(12), viewPix(6), viewPix(80), lineHeight);
    }
    return _highPressure;
}

-(UITextField *)highPressureTF{
    if(!_highPressureTF){
        _highPressureTF = [[UITextField alloc]init];
        _highPressureTF.tintColor = [UIColor colorWithString:@"#333333"];
        _highPressureTF.textColor = [UIColor colorWithString:@"#333333"];
        _highPressureTF.textAlignment = NSTextAlignmentRight;
        _highPressureTF.keyboardType = UIKeyboardTypeNumberPad;
        _highPressureTF.placeholder = @"请输入";
        _highPressureTF.font = LGFontWeight(13, UIFontWeightMedium);
        _highPressureTF.tag = 2000;
    }
    return _highPressureTF;
}

-(UILabel *)highPressureUnit{
    if(!_highPressureUnit){
        _highPressureUnit = [UILabel lableWithText:@"mmHg" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _highPressureUnit;
}

-(UILabel *)lowPressure{
    if(!_lowPressure){
        _lowPressure = [UILabel lableWithText:@"低压" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _lowPressure.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.highPressure.frame), viewPix(80), lineHeight);
    }
    return _lowPressure;
}

-(UITextField *)lowPressureTF{
    if(!_lowPressureTF){
        _lowPressureTF = [[UITextField alloc]init];
        _lowPressureTF.tintColor = [UIColor colorWithString:@"#333333"];
        _lowPressureTF.textColor = [UIColor colorWithString:@"#333333"];
        _lowPressureTF.textAlignment = NSTextAlignmentRight;
        _lowPressureTF.keyboardType = UIKeyboardTypeNumberPad;
        _lowPressureTF.placeholder = @"请输入";
        _lowPressureTF.font = LGFontWeight(13, UIFontWeightMedium);
        _lowPressureTF.tag = 2001;
    }
    return _lowPressureTF;
}

-(UILabel *)lowPressureUnit{
    if(!_lowPressureUnit){
        _lowPressureUnit = [UILabel lableWithText:@"mmHg" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _lowPressureUnit;
}

-(UILabel *)heartRate{
    if(!_heartRate){
        _heartRate = [UILabel lableWithText:@"心率" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _heartRate.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.lowPressure.frame), viewPix(80), lineHeight);
    }
    return _heartRate;
}

-(UITextField *)heartRateTF{
    if(!_heartRateTF){
        _heartRateTF = [[UITextField alloc]init];
        _heartRateTF.tintColor = [UIColor colorWithString:@"#333333"];
        _heartRateTF.textColor = [UIColor colorWithString:@"#333333"];
        _heartRateTF.textAlignment = NSTextAlignmentRight;
        _heartRateTF.keyboardType = UIKeyboardTypeNumberPad;
        _heartRateTF.placeholder = @"请输入";
        _heartRateTF.font = LGFontWeight(13, UIFontWeightMedium);
        _heartRateTF.tag = 2002;
    }
    return _heartRateTF;
}

-(UILabel *)heartRateUnit{
    if(!_heartRateUnit){
        _heartRateUnit = [UILabel lableWithText:@"次/分钟" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _heartRateUnit;
}

-(UILabel *)heightTitle{
    if(!_heightTitle){
        _heightTitle = [UILabel lableWithText:@"身高" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _heightTitle.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.heartRate.frame), viewPix(80), lineHeight);
    }
    return _heightTitle;
}

-(UITextField *)heightTF{
    if(!_heightTF){
        _heightTF = [[UITextField alloc]init];
        _heightTF.tintColor = [UIColor colorWithString:@"#333333"];
        _heightTF.textColor = [UIColor colorWithString:@"#333333"];
        _heightTF.textAlignment = NSTextAlignmentRight;
        _heightTF.keyboardType = UIKeyboardTypeDecimalPad;
        _heightTF.placeholder = @"请输入";
        _heightTF.font = LGFontWeight(13, UIFontWeightMedium);
        _heightTF.tag = 2003;
    }
    return _heightTF;
}

-(UILabel *)heightUnit{
    if(!_heightUnit){
        _heightUnit = [UILabel lableWithText:@"cm" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _heightUnit;
}

-(UILabel *)weightTitle{
    if(!_weightTitle){
        _weightTitle = [UILabel lableWithText:@"体重" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _weightTitle.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.heightTitle.frame), viewPix(80), lineHeight);
    }
    return _weightTitle;
}

-(UITextField *)weightTF{
    if(!_weightTF){
        _weightTF = [[UITextField alloc]init];
        _weightTF.tintColor = [UIColor colorWithString:@"#333333"];
        _weightTF.textColor = [UIColor colorWithString:@"#333333"];
        _weightTF.textAlignment = NSTextAlignmentRight;
        _weightTF.keyboardType = UIKeyboardTypeDecimalPad;
        _weightTF.placeholder = @"请输入";
        _weightTF.font = LGFontWeight(13, UIFontWeightMedium);
        _weightTF.tag = 2004;
    }
    return _weightTF;
}

-(UILabel *)weightUnit{
    if(!_weightUnit){
        _weightUnit = [UILabel lableWithText:@"kg" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _weightUnit;
}



-(UILabel *)abdominalTitle{
    if(!_abdominalTitle){
        _abdominalTitle = [UILabel lableWithText:@"腹围" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _abdominalTitle.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.weightTitle.frame), viewPix(80), lineHeight);
    }
    return _abdominalTitle;
}

-(UITextField *)abdominalTF{
    if(!_abdominalTF){
        _abdominalTF = [[UITextField alloc]init];
        _abdominalTF.tintColor = [UIColor colorWithString:@"#333333"];
        _abdominalTF.textColor = [UIColor colorWithString:@"#333333"];
        _abdominalTF.textAlignment = NSTextAlignmentRight;
        _abdominalTF.keyboardType = UIKeyboardTypeDecimalPad;
        _abdominalTF.placeholder = @"请输入";
        _abdominalTF.font = LGFontWeight(13, UIFontWeightMedium);
        _abdominalTF.tag = 2005;
    }
    return _abdominalTF;
}

-(UILabel *)abdominalUnit{
    if(!_abdominalUnit){
        _abdominalUnit = [UILabel lableWithText:@"cm" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _abdominalUnit;
}


-(UILabel *)heartGrade{
    if(!_heartGrade){
        _heartGrade = [UILabel lableWithText:@"心功能等级" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
        _heartGrade.frame = CGRectMake(kMinX(self.highPressure.frame), kMaxY(self.abdominalTitle.frame), viewPix(80), lineHeight);
    }
    return _heartGrade;
}

-(UITextField *)heartGradeTF{
    if(!_heartGradeTF){
        _heartGradeTF = [[UITextField alloc]init];
        _heartGradeTF.tintColor = [UIColor colorWithString:@"#333333"];
        _heartGradeTF.textColor = [UIColor colorWithString:@"#333333"];
        _heartGradeTF.textAlignment = NSTextAlignmentRight;
        _heartGradeTF.keyboardType = UIKeyboardTypeNumberPad;
        _heartGradeTF.placeholder = @"请选择";
        _heartGradeTF.font = LGFontWeight(13, UIFontWeightMedium);
        _heartGradeTF.tag = 2006;
    }
    return _heartGradeTF;
}

-(UIImageView *)heartGradeTip{
    if(!_heartGradeTip){
        _heartGradeTip = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"grayTip12"]];
    }
    return _heartGradeTip;
}

-(UIButton *)heartGradeBtn{
    if(!_heartGradeBtn){
        _heartGradeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    }
    return _heartGradeBtn;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
